<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<%@taglib prefix="code" tagdir="/WEB-INF/tags"%>

<div style="margin:20px 0;"></div>
<div class="easyui-panel">
	<div style="padding:10px 60px 20px 60px"><%--action="<c:url value='/organization/saveOrganizationDetail.do'/>"--%>
	<form id="InsInfMaintenanceForm"  name="InsInfMaintenanceForm" method="post">
	<input type="hidden" id="ins_app_uuid" name="ins_app_uuid" value="${infEntity.ins_app_uuid}"/>
	<input type="hidden" id="ins_uuid" name="ins_uuid" value="${infEntity.ins_uuid}"/>
	<input type="hidden" id="rec_id" name="rec_id" value="${infEntity.rec_id}"/>
			<table cellpadding="5" style="width:100%">
				<tr>
					<td>所属机构:</td>
					<td>
						<input class="easyui-textbox" type="text"  data-options="required:true" readonly="readonly" id="inst_name" value="${infEntity.inst_name}"/>
						<a href="javascript:void(0)" class="easyui-linkbutton detail-remove selected-remove" iconCls="icon-search" id="selelctBtn">选择</a>
					</td>
					<td>APP名称:</td>
					<td><input class="easyui-textbox" type="text"  name="app_name_app" data-options="required:true,validType:['length[0,120]']" value="${infEntity.app_name_app}"></input></td>
				</tr>
				<tr>
					<td>ios客户端app编号:</td>
					<td><input class="easyui-textbox" type="text"  id="ios_appid" name="ios_appid" data-options="required:true,validType:['length[0,120]']" value="${infEntity.ios_appid}"></input></td>
					<td>ios客户端app版本:</td>
					<td><input class="easyui-textbox" type="text"  name="ios_version" data-options="required:true,validType:['length[0,120]']" value="${infEntity.ios_version}"></input></td>
				</tr>
				<tr>
					<td>ios客户端app下载地址:</td>
					<td><input class="easyui-textbox" type="text"  name="ios_download_url" data-options="required:true,validType:['length[0,120]']" value="${infEntity.ios_download_url}"></input></td>
					<td>ios客户端app更新地址:</td>
					<td><input class="easyui-textbox" type="text"  name="ios_update_url"  data-options="required:true,validType:['length[0,120]']"  value="${infEntity.ios_update_url}"></input></td>
				</tr>
				<tr>
					<td>安卓客户端app编号:</td>
					<td><input class="easyui-textbox" type="text" id="android_appid"  name="android_appid"  data-options="required:true,validType:['length[0,120]']"  value="${infEntity.android_appid}"></input></td>
					<td>安卓客户端app版本:</td>
					<td><input class="easyui-textbox" type="text"  name="android_version"  data-options="required:true,validType:['length[0,120]']"  value="${infEntity.android_version}"></input></td>
				</tr>
				<tr>
					<td>安卓客户端app下载地址:</td>
					<td><input class="easyui-textbox" type="text"  name="android_download_url"  data-options="required:true,validType:['length[0,120]']"  value="${infEntity.android_download_url}"></input></td>
					<td>安卓客户端app更新地址:</td>
					<td><input class="easyui-textbox" type="text"  name="android_update_url"  data-options="required:true,validType:['length[0,120]']" value="${infEntity.android_update_url}"></input></td>
				</tr>
				<tr>
					<td>短信签名:</td>
					<td><input class="easyui-textbox" type="text"  name="msg_sign"   data-options="required:true,validType:['length[0,120]']" value="${infEntity.msg_sign}"></input></td>
					<td>短信通道类型:</td>
					<td><code:codeSelect id="sms_type" name="sms_type" code_type="SMS_TYPE" selectId="${infEntity.sms_type}"></code:codeSelect></td>
				</tr>
				<tr>
					<td>短信通道用户名:</td>
					<td><input class="easyui-textbox" type="text"  name="sms_username"  data-options="required:true,validType:['length[0,120]']"   value="${infEntity.sms_username}"></input></td>
					<td>短信通道密码:</td>
					<td><input class="easyui-textbox" type="text"  name="sms_password" value="${infEntity.sms_password}" data-options="required:true,validType:['length[0,120]']"></input></td>
				</tr>
				<%--<tr>
					<td>实名制认证通过时是否送短信:</td>
					<td><code:codeSelect id="custom_auth_pass_st" name="custom_auth_pass_st" code_type="CUSTOM_AUTH_PASS_ST" selectId="${infEntity.custom_auth_pass_st}"></code:codeSelect></td>
					<td>短信认证退回修改时是否发送短信:</td>
					<td><code:codeSelect id="custom_auth_nopass_st" name="custom_auth_nopass_st" code_type="CUSTOM_AUTH_NOPASS_ST" selectId="${infEntity.custom_auth_nopass_st}"></code:codeSelect></td>
				</tr>
				<tr>
					<td>实名认证通过时的提示信息:</td>
					<td><input class="easyui-textbox" type="text"  name="custom_auth_pass_msg"  data-options="required:true,validType:['length[0,120]']"  value="${infEntity.custom_auth_pass_msg}"></input></td>
					<td>实名认证退回修改时的提示信息:</td>
					<td><input class="easyui-textbox" type="text" name="custom_auth_nopass_msg"  data-options="required:true,validType:['length[0,120]']"   value="${infEntity.custom_auth_nopass_msg}" ></input></td>
				</tr>--%>
				<tr>
					<td>APP广告启动等待时间:</td>
					<td><input class="easyui-textbox" type="text"  name="adv_wait_tm"  data-options="required:true,validType:['advWaitTm']"  value="${infEntity.adv_wait_tm}"></input></td>
					<td>客户端注册时推荐人会员是否必填:</td>
					<td><code:codeSelect id="super_custom_st"  name="super_custom_st" code_type="SUPER_CUSTOM_ST" selectId="${infEntity.super_custom_st}"></code:codeSelect></td>
				</tr>
				<tr>
					<td>极光推送appkey:</td>
					<td><input class="easyui-textbox" type="text"  name="jg_appkey"   data-options="required:true,validType:['length[0,120]']" value="${infEntity.jg_appkey}"></input></td>
					<td>极光推送mastersecret:</td>
					<td><input class="easyui-textbox" type="text"  name="jg_mastersecret"   data-options="required:true,validType:['length[0,120]']" value="${infEntity.jg_mastersecret}"></input></td>
				</tr>
				<tr>
					<td>广告批次号:</td>
					<td><input class="easyui-textbox" type="text"  name="app_adv_batchno"   data-options="required:true,validType:['length[0,120]']" value="${infEntity.app_adv_batchno}"></input></td>
					<td>分享标题:</td>
					<td><input class="easyui-textbox" type="text"  name="share_title"   data-options="required:true,validType:['length[0,120]']" value="${infEntity.share_title}"></input></td>
				</tr>
				<tr>
					<td>分享说明:</td>
					<td><input class="easyui-textbox" type="text" name="share_desc" data-options="required:true,multiline:true" value="${infEntity.share_desc}"/></td>
				</tr>
			</table>
	<div style="text-align:center;padding:5px">
		<%--<a href="javascript:void(0)" class="easyui-linkbutton btn detail-remove" iconCls="icon-save" onclick="submitForm('InsInfMaintenanceForm')">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton btn" iconCls="icon-back" onclick="back()">返回</a>--%>
			<jiepos:buttonDetailTag menuCode="${menuCode}" formId="InsInfMaintenanceForm"></jiepos:buttonDetailTag>
	</div>
</form>
	</div>
</div>
<%--<div id="commonTree">
	<div id="ztreeObj" class="ztree"></div>
</div>--%>
<div id="menuTree">
	<div id="ztreeObj" class="ztree"></div>
</div>
<script>
    var baseUrl = "${pageContext.request.contextPath}";
    function openApp(url){
        window.location.href=url;
    }
    $.extend($.fn.textbox.defaults.rules, {
        advWaitTm: {
            validator: function(value){
                var reg = new RegExp("^[0-9]*$");
                return reg.test(value);
            },
            message: '广告等待启动时间只能是数字'
        }
    });
    var ztreeObj;
    /*选择按钮*/
    $("#selelctBtn").click(function(){
        ztreeObj = showInsTree(selected, $("#ins_uuid").val());
    });

    /*确定按钮回调*/
    function selected(){
        var nodes = ztreeObj.getSelectedNodes();
        console.log(nodes);
        if(nodes && nodes.length > 0){
            $("#inst_name").textbox("setValue", nodes[0].NAME);
            $("#ins_uuid").val(nodes[0].ID);
        }
    }
    //不可修改机构
    $(document).ready(function() {
        var ins_app_uuid = $.trim($("#ins_app_uuid").val());
        if(ins_app_uuid != null && ins_app_uuid != ''&& ins_app_uuid != undefined){
            $("a").attr("readonly", "readonly");
            $(".selected-remove").remove();
        }
    });

    function saveInf(urls) {
        var ios_appid = $.trim($("#ios_appid").val());
        var android_appid = $.trim($("#android_appid").val());
        var ins_app_uuid = $.trim($("#ins_app_uuid").val());
        var ins_uuid = $.trim($("#ins_uuid").val());
        if($("#InsInfMaintenanceForm").form("validate")) {
            var options = {
                type: "post",
               /* url: baseUrl + "/organization/exitInsApp.do",*/
                url:'<c:url value="/organization/exitInsApp.do"/>',
                success: function (data) {
                    if (data == '3') {
                        $.jpmessage.warning("此机构已存在!");
                        return false;
                    } else if(data == '1'){
                        $.jpmessage.warning("此APPID已存在!");
                        return false;
                    }else {
                        $("#InsInfMaintenanceForm").attr("action", urls);
                        document.getElementById("InsInfMaintenanceForm").submit();
                    }
                },
                error: function (data) {
                    $.jpmessage.warning("保存发生错误");
                }
            };
            $("#InsInfMaintenanceForm").ajaxSubmit(options);
        }
    }
</script>